//
//  HXOpinionDetailTableViewController.m
//  KD
//
//  Created by ifly on 16/8/10.
//  Copyright © 2016年 Whx. All rights reserved.
//

#import "HXOpinionDetailTableViewController.h"
#import "HXFeedBackGetKindDataModel.h"
#import "HXEditOpinionViewController.h"

@interface HXOpinionDetailTableViewController ()

@property (nonatomic,strong) NSMutableArray <HXFeedBackGetKindDataResultModel *>*dataArray;
@property (nonatomic,copy) NSString * DataText;

@end

@implementation HXOpinionDetailTableViewController

static NSString * cellId = @"HXOpinionDetailTableViewController";
-(instancetype)initWithNsmutableArray:(NSMutableArray <HXFeedBackGetKindDataResultModel *> *)dataArray
                         withDataText:(NSString *)DataText{
    
    if ([super init]) {
        _dataArray = dataArray;
        self.DataText = DataText;
    }
    return self;
}
//-(instancetype)initWithDataID:(NSString *)DataID
//                 withDataText:(NSString *)DataText{
//
//    if ([super init]) {
//        
//        self.DataID   = DataID;
//        self.DataText = DataText;
//    }
//    
//    return self;
//}



- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"意见反馈";

    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:cellId];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return _dataArray.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId forIndexPath:indexPath];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    cell.textLabel.text = _dataArray[indexPath.row].DataText;
    return cell;
}

-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
    
    return @"请选择问题发生场景";
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    
    return 40.f;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    HXEditOpinionViewController * editVc = [[HXEditOpinionViewController alloc] initWithQueText:self.DataText withSceneText:self.dataArray[indexPath.row].DataText];
    [self.navigationController pushViewController:editVc animated:YES];
}



-(NSMutableArray *)dataArray {
    if (_dataArray == nil) {
        _dataArray = [[NSMutableArray alloc] init];
    }
    return _dataArray;
}



@end
